﻿using System;
using System.Windows.Input;

namespace Plugins
{
    public interface IPlugin
    {
        /// <summary>
        /// State event of IPlugin.
        /// </summary>
        event EventHandler<StateEventArgs> Event;

        /// <summary>
        /// Gets or sets whether the IPlugin has focus. (Is set to active)
        /// </summary>
        bool HasFocus
        {
            get;
            set;
        }

        /// <summary>
        /// Gets plugin name
        /// </summary>
        string PluginName
        {
            get;
        }

        /// <summary>
        /// Gets file filter string for OpenFileDialog
        /// </summary>
        string FileFilter
        {
            get;
        }

        /// <summary>
        /// Gets expression language name.
        /// </summary>
        string ExpressionLanguageName
        {
            get;
        }
                
        /// <summary>
        /// Gets or sets ICore instance.
        /// </summary>
        ICore Core
        {
            set;
            get;
        }
    }

    public class StateEventArgs : EventArgs
    {
        public enum PluginState
        {
            SHOWED,
            FILE_VALIDATION_OK,
            FILE_VALIDATION_FAILED,
            EXPRESSION_VALIDATION_OK,
            EXPRESSION_VALIDATION_FAILED,
            PROGRAM_FAILED
        }

        PluginState _state;


        public StateEventArgs(PluginState state)
            : base()
        {
            _state = state;
        }

        /// <summary>
        /// Gets state
        /// </summary>
        public PluginState State
        {
            get { return _state; }
        }
    }
}
